home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigarom 1
/
Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso
/
FILES
/
HYP
/
C-D
/
ChangeObjectLayer.cpt
/
ChangeObjectLayer
/
background_2599.txt
< prev
next >
Wrap
Text File
|
1989-04-13
|
10KB
|
413 lines
-- background: 2599 from stack: in
-- bmap block id: 3218
-- flags: 0000
-- background id: 0
-- name:
----- HyperTalk script -----
--ChangeObjectLayer 1.0
--©1988 by Dean H Wette
--921 DeMun Avenue 2N
--Clayton, MO 63105
--314-863-4944
--CompuServe 72317,2034
--Please include the above credits with the script.
--This stack is TradeWare. See the "About..." window
--for more information and instructions.
------------------------------------------------------------------------
--The best place for these scripts is in the Home stack, thus
--making "ChangeObjectLayer" available to all your stacks.
--Begin ChangeObjectLayer 1.0
--This is the handler called by the target object.
--The call, "setLayer", should be the second line
--of the object's script, after "on mouseUp".
on setLayer
global objectNumber,objectType,optionState
put the optionKey into optionState
--We need information about the target object — get it from
--the "objectInfo" function.
put objectInfo() into doMenuWhich
lock screen
set lockMessages to true
--Go from the browse tool to the object's editing tool
--and select the object.
if objectType = "button" then choose btn tool else choose fld tool
select the target
--This is where the work gets done.
repeat until the number of the target = objectNumber
set cursor to busy
--Find out if the object goes to a higher or lower layer, or
--if it's all just a waste of time.
if doMenuWhich < 0 then doMenu "Send Farther"
if doMenuWhich > 0 then doMenu "Bring Closer"
if doMenuWhich = 0 then exit repeat
end repeat
beep
--We're finished so let's clean up & return everything to normal.
set cursor to 4
choose browse tool
unlock screen
set lockMessages to false
put empty into objectNumber
put empty into objectType
put empty into optionState
--Let's remove the "setLayer" call for the user, that is,
--if it's in the right place!
if line 2 of script of target contains "setLayer" then
put script of target into objectScript
put empty into line 2 of objectScript
set script of target to objectScript
else
end if
--We just want to change the object's layer so let's not
--execute its normal script
exit to HyperCard
end setLayer
--This is the function that returns all the object information
--needed to allow "setLayer" to perform properly.
function objectInfo
global objectNumber,objectType,optionState
--Is the Object a field or a button?
if the name of the target contains "field" then
put "field" into objectType
else
put "button" into objectType
end if
--Is the object a card or background object?
if the name of the target contains "bkgnd" then
put "bkgnd" into objectClass
else
put "card" into objectClass
end if
--What is the object's current number?
put the number of the target into fromThis
--What is the highest possible number of the object
if objectType = "button" then
if the name of the target contains "bkgnd" then
put the number of last bg btn into theRange
else
put the number of last btn into theRange
end if
else
if objectType = "field" then
if the name of the target contains "card" then
put the number of last cd field into theRange
else
put the number of last field into theRange
end if
end if
end if
--Now we know the object's possible range.
--This is the function part of the function. It returns
--the target number of the object.
--Prompt the user for a target object number
--& give the valid range of numbers.
ask "Set " &objectClass &&objectType &&fromThis && "to what number? (1-" &theRange &")"
if it is empty then exit to HyperCard
set cursor to 4
put it into objectNumber
--If user holds down option key while invoking "setLayer"
--then the following error checking is bypassed.
if optionState is up then
--Error checking...make sure the user enters a valid number.
if objectNumber > theRange or objectNumber < 1 then
beep
answer "Sorry! “" &objectNumber &"” is not a valid " &objectType &&"number."
exit to HyperCard
else
end if
end if
--Now we have the target number and information we need to proceed.
return objectNumber - fromThis
end objectInfo
--end ChangeObjectLayer 1.0
------------------------------------------------------------------------
--YOU NEED ALL THE ABOVE SCRIPTS FOR "CHANGEOBJECTLAYER" TO WORK!!!
-- part 13 (button)
-- low flags: 00
-- high flags: 8004
-- rect: left=24 top=215 right=231 bottom=241
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Background Button 1
----- HyperTalk script -----
on mouseUp
setlayer
lock screen
repeat with i = 1 to 6
set the name of bg btn i to "Background Button " & i
end repeat
unlock screen
end mouseUp
-- part 14 (button)
-- low flags: 00
-- high flags: 8004
-- rect: left=30 top=228 right=244 bottom=235
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Background Button 2
----- HyperTalk script -----
on mouseUp
setlayer
lock screen
repeat with i = 1 to 6
set the name of bg btn i to "Background Button " & i
end repeat
unlock screen
end mouseUp
-- part 15 (button)
-- low flags: 00
-- high flags: 8004
-- rect: left=36 top=241 right=257 bottom=229
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Background Button 3
----- HyperTalk script -----
on mouseUp
setlayer
lock screen
repeat with i = 1 to 6
set the name of bg btn i to "Background Button " & i
end repeat
unlock screen
end mouseUp
-- part 16 (button)
-- low flags: 00
-- high flags: 8004
-- rect: left=43 top=254 right=270 bottom=222
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Background Button 4
----- HyperTalk script -----
on mouseUp
setlayer
lock screen
repeat with i = 1 to 6
set the name of bg btn i to "Background Button " & i
end repeat
unlock screen
end mouseUp
-- part 1 (button)
-- low flags: 00
-- high flags: 8004
-- rect: left=18 top=213 right=330 bottom=248
-- title width / last selected line: 0
-- icon id / first selected line: 27056 / 27056
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Background Button 5
----- HyperTalk script -----
on mouseUp
setlayer
lock screen
repeat with i = 1 to 6
set the name of bg btn i to "Background Button " & i
end repeat
unlock screen
end mouseUp
-- part 18 (field)
-- low flags: 01
-- high flags: 0004
-- rect: left=263 top=224 right=322 bottom=473
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 4
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name:
----- HyperTalk script -----
on mouseUp
setLayer
repeat with i = 1 to 6
put "Background Field " &the number of bg fld i into line 1 of bg field i
end repeat
end mouseUp
-- part 21 (field)
-- low flags: 01
-- high flags: 0004
-- rect: left=273 top=235 right=313 bottom=462
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 4
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name:
----- HyperTalk script -----
on mouseUp
setLayer
repeat with i = 1 to 6
put "Background Field " &the number of bg fld i into line 1 of bg field i
end repeat
end mouseUp
-- part 22 (field)
-- low flags: 01
-- high flags: 0004
-- rect: left=283 top=246 right=304 bottom=452
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 4
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name:
----- HyperTalk script -----
on mouseUp
setLayer
repeat with i = 1 to 6
put "Background Field " &the number of bg fld i into line 1 of bg field i
end repeat
end mouseUp
-- part 23 (field)
-- low flags: 01
-- high flags: 0004
-- rect: left=293 top=257 right=295 bottom=442
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 4
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name:
----- HyperTalk script -----
on mouseUp
setLayer
repeat with i = 1 to 6
put "Background Field " &the number of bg fld i into line 1 of bg field i
end repeat
end mouseUp
-- part 24 (field)
-- low flags: 01
-- high flags: 0004
-- rect: left=303 top=268 right=286 bottom=432
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 4
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name:
----- HyperTalk script -----
on mouseUp
setLayer
repeat with i = 1 to 6
put "Background Field " &the number of bg fld i into line 1 of bg field i
end repeat
end mouseUp
-- part 7 (field)
-- low flags: 01
-- high flags: 4004
-- rect: left=253 top=213 right=331 bottom=484
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 4
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name:
----- HyperTalk script -----
on mouseUp
setLayer
if the number of me = 6 then
put "Change me to Background Field 1!" into line 5 of me
set the showlines of me to true
else
put empty into line 5 of me
set the showlines of me to false
end if
repeat with i = 1 to 6
put "Background Field " &the number of bg fld i into line 1 of bg field i
end repeat
end mouseUp